package customize

import (
	"gitcode.com/G-YT/baoyou/server/global"
	"gitcode.com/G-YT/baoyou/server/model/cms"
	"gitcode.com/G-YT/baoyou/server/model/user"
	"time"
)

type Item struct {
	Key string `json:"key"`
	Msg string `json:"msg"`
}

type UserConstitution struct {
	Constitution string
	Score        string
}

// Constitution 体质
type Constitution struct {
	ID   uint   `json:"id" form:"id" gorm:"column:id;comment:id;"`
	Name string `json:"name" form:"name" gorm:"column:name;comment:名称;"`
}

// ConstitutionArticle 体质文章
type ConstitutionArticle struct {
	ConstitutionID uint          `json:"constitution_id" from:"constitution_id" gorm:"column:constitution_id;"`
	ArticleID      uint          `json:"article_id" gorm:"column:article_id;"`
	Type           string        `json:"type" gorm:"column:type;"`
	Constitution   *Constitution `json:"-" form:"-" gorm:"->;foreignKey:ConstitutionID;references:ID;"` // 关联体质
	AudioArticle   *cms.Article  `json:"-" form:"-" gorm:"->;foreignKey:ArticleID;references:ID;"`      // 关联音频文章
	VideoArticle   *cms.Article  `json:"-" form:"-" gorm:"->;foreignKey:ArticleID;references:ID;"`      // 关联视频文章
	TextArticle    *cms.Article  `json:"-" form:"-" gorm:"->;foreignKey:ArticleID;references:ID;"`      // 关联文本文章
}

// ConstitutionQuestionLog 体质问卷报告
type ConstitutionQuestionLog struct {
	global.GvaModel
	BloodType          string     `json:"blood_type" gorm:"column:blood_type;comment:血型;default:没有填写;"`
	BloodSugar         string     `json:"blood_sugar" gorm:"column:blood_sugar;comment:血糖;default:0;"`
	HRV                string     `json:"HRV" gorm:"column:HRV;comment:HRV指数;default:0;"`
	BloodConcentration string     `json:"blood_concentration" gorm:"column:blood_concentration;comment:血氧浓度;default:0;"`
	HRres              string     `json:"HRres" gorm:"column:HRres;comment:心率;default:0;"`
	LowTension         string     `json:"low_tension" gorm:"column:low_tension;comment:低压"`
	HighTension        string     `json:"high_tension" gorm:"column:high_tension;comment:高压"`
	Birthday           time.Time  `json:"birthday" gorm:"column:birthday;comment:生日"`
	Results            string     `json:"results" gorm:"column:results;comment:问卷答案结果集"`
	ScoreData          string     `json:"score_data" gorm:"column:score_data;comment:得分结果集"`
	Physique           string     `json:"habitus" gorm:"column:habitus;comment:体质"`
	PhysiqueId         uint       `json:"physique_id" gorm:"column:physique_id;comment:体质ID"`
	Uid                uint       `json:"uid" gorm:"column:uid;comment:用户ID"`
	User               *user.User `json:"User" gorm:"foreignKey:Uid;references:ID"`
	Remark             string     `json:"remark" gorm:"column:remark;comment:备注"`
	Mah                string     `json:"mah" gorm:"column:mah;comment:药物过敏史;default:无;"`
	Sh                 string     `json:"sh" gorm:"column:sh;comment:手术史;default:无;"`
	Hs                 *bool      `json:"hs" gorm:"column:hs;comment:心脏支架 1有 0无;default:0"`
	Pacemaker          *bool      `json:"pacemaker" gorm:"column:pacemaker;comment:心脏起搏器 1有 0无;default:0"`
	Other              string     `json:"other" gorm:"column:other;comment:其他;default:无"`
}

func (Constitution) TableName() string {
	return "by_constitution"
}

func (ConstitutionArticle) TableName() string {
	return "by_constitution_article"
}

func (ConstitutionQuestionLog) TableName() string {
	return "by_constitution_question_log"
}
